﻿idmod_manchu_sino = {
	is_shown = {
		exists = c:MCH
		this = c:MCH
		country_has_primary_culture = cu:manchu

		is_subject = no
 
	}

	possible = {
			coa_absolute_monarchy_trigger = yes
		has_technology_researched = nationalism
		has_technology_researched =pan-nationalism
		has_technology_researched = philosophical_pragmatism
		
		has_technology_researched = identification_documents
	}
	when_taken = {
					
			trigger_event = { id = boxer_rebellion_events.3 popup = yes }
			remove_modifier = id_linguistic_banner_discrimination
					ig:ig_landowners = { 
			set_interest_group_name = ig_id_junhu
			remove_ideology = ideology_stratocratic
			add_ideology = ideology_banner_stratocratic
			add_ideology = ideology_isolationist
			
		}
		
		ig:ig_intelligentsia = { 
			set_interest_group_name = ig_id_donglindang
			add_ideology = ideology_anti_clerical
			remove_ideology = ideology_banner_stratocratic
			
		}
		ig:ig_rural_folk  = {
			set_interest_group_name = ig_id_zigengnong
			remove_ideology = ideology_banner_stratocratic
		}
		ig:ig_industrialists = {
			set_interest_group_name = ig_id_zhizaoju
			remove_ideology = ideology_banner_stratocratic
		}
		ig:ig_devout = {
			set_interest_group_name = ig_id_shidafu
			add_ideology = ideology_pious
			add_ideology = ideology_moralist
			remove_ideology = ideology_banner_stratocratic
		}
				ig:ig_petty_bourgeoisie = {
			set_interest_group_name = ig_id_fushe
			remove_ideology = ideology_banner_stratocratic
		}
	}
	
}

idmod_han_sino = {
	is_shown = {
		any_primary_culture = {
		has_discrimination_trait = han_chinese
		}
		NOT = { country_has_primary_culture = cu:han}
	}

	possible = {
		any_primary_culture = {
		has_discrimination_trait = han_chinese
		}
		NOT = { country_has_primary_culture = cu:han}
	}
	when_taken = {
		add_modifier = {
			name = united_in_righteousness	
			months = long_modifier_time
		}
			add_primary_culture = cu:han
		
	}
	
	ai_chance = {
		base = 10
	}
}
idmod_han_off_tpg = {
	is_shown = {
		is_player = yes
	 country_has_primary_culture = cu:han
		NOT = {  has_global_variable = id_heavenly_kingdom_off}
	 }

	possible = {
		always = yes
	}
	when_taken = {
set_global_variable = id_heavenly_kingdom_off
		
	}
	
	ai_chance = {
		base = 0
	}
}
idmod_han_remove_keju = {
	is_shown = {
has_modifier = id_linguistic_keju
	}

	possible = {
has_technology_researched = psychiatry
has_technology_researched = mass_communication

NOT = {has_law = law_type:law_no_schools }
	}
	when_taken = {
	add_technology_progress = { progress = 25000 technology = nationalism }
remove_modifier = id_linguistic_keju
c:MCH = {
every_subject_or_below = {
					change_relations = { 
				country = c:MCH 
				value = -150 
			}
			}
	}
	}
	
	ai_chance = {
		base = 10
	}
}

idmod_han_remilitize = {
	is_shown = {
has_modifier = id_military_decrease
	}

	possible = {
has_technology_researched = general_staff
		has_technology_researched = international_relations
		


	}
	when_taken = {
remove_modifier = id_military_decrease
c:MCH = {
every_subject_or_below = {
							change_relations = { 
				country = c:MCH 
				value = -150 
			}
			}
	}
	}
	ai_chance = {
		base = 10
	}
}

idmod_han_beifa = {
	is_shown = {
	always = no
	
	country_has_primary_culture = cu:han
	AND = {
		exists = overlord
	overlord = {
	this = c:MCH
	country_has_primary_culture = cu:manchu
	}
	}
	}

	possible = {
has_technology_researched = nationalism
NOT = {has_modifier = id_military_decrease}
NOT = {has_modifier = id_linguistic_keju}
	}
	when_taken = {
						change_relations = { 
				country = c:MCH 
				value = -300
			}
remove_modifier = id_nation_lost

	}
	
	ai_chance = {
		base = 10
	}
}
idmod_han_guangfu = {
	is_shown = {
	country_has_primary_culture = cu:han
	OR = {
NOT = {has_modifier = id_nation_guangfu }
has_modifier = id_nation_lost
country_has_primary_culture = cu:manchu
}
	}

	possible = {
	OR = {
	is_subject = no
	
	overlord = {
	OR = {
	NOT = {	AND = {
            exists = c:MCH
          c:MCH  = THIS
}}
	country_has_primary_culture = cu:manchu
	}
	}
	
	}
has_technology_researched = nationalism
NOT = {has_modifier = id_military_decrease}
NOT = {has_modifier = id_linguistic_keju}
OR = {
has_modifier = id_nation_hanzizhuyin

AND = {
            exists = c:CHI
          c:CHI  = THIS
}
is_subject = no
}

}


	
	when_taken = {
	custom_tooltip = je_id_unify_1_china_tooltip_tt
	hidden_effect = {
	s:STATE_SAKHALIN = {
			
				add_homeland = han
	
				add_claim = ROOT
			
				
				
			
			}
			sr:region_manchuria = {
				every_scope_state = {
			
														this.state_region = {
				add_claim = ROOT
					add_homeland = han
			}
				
				}
			
			}		
			sr:region_south_china = {
						every_scope_state = {
			
														this.state_region = {
				add_claim = ROOT
					add_homeland = han
			}
				
				}
			
			}
						sr:region_north_china = {
						every_scope_state = {
				
														this.state_region = {
				add_claim = ROOT
				add_homeland = han
			}
				
				}
			
			}
									sr:region_himalayas = {
						every_scope_state = {
			
														this.state_region = {
				add_claim = ROOT
					add_homeland = han
			}
				
				}
			
			}
}
			add_journal_entry = {
			type = je_id_north_empire
		}
				add_journal_entry = {
			type = je_id_west_empire
		}
				add_journal_entry = {
			type = je_id_south_empire
		}
remove_modifier = id_nation_jihuizhidi
remove_modifier = id_nation_lost
remove_modifier = id_nation_daoke
remove_modifier = id_nation_zhixiaqu
remove_primary_culture = cu:manchu	
every_scope_state = {
			add_loyalists = {
				value =1.0
			}
			}
if = {
limit = {
NOT = {has_modifier = id_nation_guangfu }
}
add_modifier = id_nation_guangfu	
}
if = {
limit = {
		exists = overlord
	overlord = {
	this = c:MCH
	country_has_primary_culture = cu:manchu
	}
}
make_independent = yes
}

	}
	
	ai_chance = {
		base = 10
	}
}
idmod_han_zhuyin = {
	is_shown = {
 NOT = {has_modifier = id_nation_hanzizhuyin }
		any_primary_culture = {
		has_discrimination_trait = han_chinese
		}
	}

	possible = {
has_technology_researched = mass_communication
has_technology_researched = dialectics

	}
	when_taken = {
add_modifier = id_nation_hanzizhuyin
		
	}
	
	ai_chance = {
		base = 10
	}
}
idmod_han_capital = {
	is_shown = {
 NOT = {has_global_variable = id_chi_capital }
 exists = c:CHI
	this = c:CHI
	}

	possible = {
has_modifier = id_nation_guangfu
any_scope_state = { state_region = s:STATE_BEIJING }
	}
	when_taken = {
trigger_event = { id = idchi.1 popup = yes }
		set_global_variable = id_chi_capital
	}
	
	ai_chance = {
		base = 10
	}
}
idmod_han_dongbei = {
	is_shown = {
		OR = {
		AND = {
		exists = c:HHW
		ROOT = c:HHW
		
		}
				AND = {
		exists = c:HSY
		ROOT = c:HSY
		
		}
				AND = {
		exists = c:HHL
		ROOT = c:HHL
		
		}
				AND = {
		exists = c:HJL
		ROOT = c:HJL
		
		}
		}
		country_has_primary_culture = cu:manchu
	}

	possible = {
	
OR = {
 year > 1880
 AND = {
 is_player = yes
 gold_reserves > 10000
 }
 any_country = {
 country_has_primary_culture = cu:han
 has_diplomatic_pact = { who = ROOT type = bankroll }
 }
 }
	}
	when_taken = {
	add_modifier = id_nation_jihuizhidi
set_state_religion = rel:confucianism
remove_primary_culture = cu:manchu	
add_primary_culture = cu:han
every_scope_state = {
this.state_region = {
add_homeland = han
}
}


random_scope_state = {
						create_pop = {
					pop_type = farmers
					culture = han
					size =560000		
				}
				
										create_pop = {
					pop_type = peasants
					culture = han
					size = 760000		
				}
										create_pop = {
					pop_type = soldiers
					culture = han
					size = 82634	
				}
														create_pop = {
					pop_type = officers
					culture = han
					size = 32634	
				}
				}

						custom_tooltip = je_id_military_china_tooltip_tt	
		hidden_effect = {
		c:MCH = {
				create_diplomatic_pact = {
			country = ROOT
			type = id_dujun
		}	
		}
		
		}
								set_variable = {
			name = id_northeast_completion
			value = 0
		}
		add_journal_entry = { type = id_northeast_obsession }

	}
	
	ai_chance = {
		base = 10
		modifier = {
			trigger = { 
				weekly_net_fixed_income > money_amount_multiplier_medium
				gold_reserves < 0		
			}
			add = 1000
		}
	}
}